import 'package:base_plugin/base_plugin.dart';
import 'package:finance_app/generated/a.dart';
import 'package:finance_app/generated/l10n.dart';
import 'package:finance_app/src/common/app_colors.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';

class BalanceChooseButton extends StatelessWidget {
  final String title;
  final String number;
  final String overdueNumber;
  final VoidCallback onTap;
  final Color numberColor;
  final Color borderColor;

  const BalanceChooseButton(
      {Key key,
      this.title,
      this.number,
      this.overdueNumber,
      this.onTap,
      this.numberColor,
      this.borderColor})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: EdgeInsets.symmetric(horizontal: getDp(21)),
      child: SizedBox(
        height: getDp(overdueNumber == null ? 90 : 114),
        child: PressedOpacityButton(
          onPressed: onTap ?? () {},
          color: Colors.white,
          padding: EdgeInsets.only(
              left: getDp(18),
              right: getDp(18),
              top: getDp(20),
              bottom: getDp(20)),
          borderRadius: BorderRadius.circular(getSp(15)),
          border: Border.all(color: borderColor, width: getDp(1)),
          child: Container(
            alignment: Alignment.center,
            child: Stack(
              children: [
                Align(
                  alignment: Alignment.centerLeft,
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    mainAxisAlignment: MainAxisAlignment.spaceAround,
                    children: [
                      Text(
                        title,
                        style: TextStyle(
                          color: aceBlackColor,
                          fontWeight: FontWeight.w400,
                          fontSize: getSp(14),
                          height: 1,
                        ),
                      ),
                      Text(
                        '$number',
                        style: TextStyle(
                          color: aceBlackColor,
                          fontSize: getSp(20),
                          fontWeight: FontWeight.w700,
                          height: 1,
                        ),
                      ),
                      if (overdueNumber != null)
                        Container(
                          decoration: BoxDecoration(
                            border: Border.all(
                              color: aceRedColor,
                              width: getDp(1),
                            ),
                            borderRadius: BorderRadius.circular(getDp(15)),
                          ),
                          padding: EdgeInsets.symmetric(
                            horizontal: getDp(10),
                            vertical: getDp(3),
                          ),
                          child: Text(
                            '${S.current.overdue}:$overdueNumber',
                            style: TextStyle(
                              color: aceRedColor,
                              fontSize: getSp(12),
                              fontWeight: FontWeight.w400,
                              height: 14 / 12,
                            ),
                          ),
                        ),
                    ],
                  ),
                ),
                if (onTap != null)
                  Align(
                    alignment: Alignment.centerRight,
                    child: Padding(
                      padding: EdgeInsets.only(right: getDp(32 - 18.0)),
                      child: SvgPicture.asset(
                        A.assetsImagesRight,
                        width: getDp(13),
                        height: getDp(18),
                      ),
                    ),
                  ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}
